<%- @page_title = _('Viewing User %s', h(@user.name)) -%>
<h2><%= h(@user.name) %>
  <%- if(@logged_user.is_teacher? || (@logged_user.id == @user.id)) -%>
    <span class="quick-tip"><%= link_to(_('Edit'), edit_user_path(@user)) %></span>
  <%- end -%>
</h2>
<div class="formatted-text"><!--O .formatted-text-->
  <p><strong><%= _("Email") %>:</strong> <%= link_to(h(@user.email), "mailto:#{@user.email}") %></p>
  <%- if @user.is_teacher? -%>
    <p><%= _("This user is a teacher") %>.</p>
  <%- end -%>
</div><!--C .formatted-text-->
<%- if @logged_user.is_teacher? -%>
  <%- unless @user.is_teacher? || @user.groups.empty? -%>
    <hr />
    <strong>Groups</strong>
    <ul>
      <%- @user.groups.each do |g| -%>
        <li><%= link_to(h(g.name), group_path(g.teaching.project_id, g.teaching, g)) %> (class <%= h(g.teaching.title) %>)</li>
      <%- end -%>
    </ul>
  <%- end -%>
  <hr />
  <%- form_tag(user_path(@user),
                :method => :delete,
                :onsubmit => "if(confirm('#{_('Are you sure you want to delete this user?')}')){Field.disable('submit-form'); return true;}else{return false;}") do -%>
    <%= submit_tag(_('Delete this user'),
                    :class => 'button',
                    :id => 'submit-form') %>
  <%- end -%>
  <hr />
  <%= link_to(_("&laquo; View all users"), users_path) %>
<%- end -%>